package mcom.xmks.bluetooth.mesh.base;

import android.annotation.SuppressLint;
import android.bluetooth.le.ScanCallback;

import cn.wch.meshlib.core.MeshServer;

public abstract class ScanBaseActivity extends AbstractActivity {
    private MeshServer meshServer=MeshServer.getInstance();
//    @SuppressLint("MissingPermission")
//    protected void startScanUnConfiguredBLE(ScanCallback scanCallback){
//        try {
//            meshServer.scanUnConfiguredBLE(scanCallback);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//    @SuppressLint("MissingPermission")
//    protected void startScanConfiguredBLE(ScanCallback scanCallback){
//        try {
//            meshServer.scanConfiguredBLE(scanCallback);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }

    /**
     * 开始扫描BLE
     * @param isConfigured 扫描已配置网络的设备
     * @param scanCallback 扫描回调
     */
    @SuppressLint("MissingPermission")
    protected void startScanBLE(boolean isConfigured, ScanCallback scanCallback){
        try{
            meshServer.startScan(isConfigured,scanCallback);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    protected void stopScanBLE(){
        meshServer.stopScan();
    }
}
